import BasicLayout from '@/layouts/basicLayout.vue';
const BlankLayout = () => import('@/layouts/blankLayout.vue');
export const constantRoutes = [
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/login/index.vue')
        // component: () => import("@/views/home/chart.vue"),
    },
    {
        path: '/404',
        component: () => import('@/views/error/404.vue')
    }
];
export const notFount = { path: '/:pathMatch(.*)*', redirect: '/404' };
/*
 * @param {string} path 路径
 * @param {string} name 名称
 * @param {object} component 组件
 * @param {object} meta 元信息
 * @param {array} children 子级菜单
 * @param {string} meta.title 标题
 * @param {string} meta.icon 图标
 * @param {boolean} meta.isKeepAlive 是否开启keep-alive缓存
 * @param {number} meta.level 层级 (当菜单栏多级嵌套时，用于判断当前菜单的层级，进行格式缩进)
 * @param {boolean} meta.hideMenu 隐藏菜单栏 (当前菜单不显示在菜单栏，类似某些tabs切换，并不显示在菜单栏但切换时页面会进行路由跳转)
 * @param {string} meta.parentName 父级菜单名称,用于特殊情况，比如当前子菜单在菜单栏是隐藏的，它显示在其父级页面中，做tab切换时路由进行跳转
 */
export const asyncRouters = [
    {
        path: '/home',
        name: 'home',
        // component: () => import("@/views/home/index.vue"),
        component: () => import('@/views/home/chart.vue'),
        // component: () => import("@/views/home/upload.vue"),
        meta: { title: '部门架构', icon: 'message' }
    },
    {
        path: '/user',
        name: 'user',
        meta: { title: '一级菜单', icon: 'user', isKeepAlive: true },
        children: [
            {
                path: '/user/user_item_one',
                name: 'userItemOne',
                meta: { title: '二级菜单1', isKeepAlive: true },
                children: [
                    {
                        path: '/user/user_item_one/child_one',
                        name: 'userItemOneChildOne',
                        meta: { title: '三级菜单1', isKeepAlive: false },
                        component: () => import('@/views/user/itemOneChild/childOne.vue')
                    },
                    {
                        path: '/user/user_item_one/child_two',
                        name: 'userItemOneChildTwo',
                        meta: { title: '三级菜单2', isKeepAlive: true },
                        component: () => import('@/views/user/itemOneChild/childTwo.vue')
                    },
                ]
            },
            {
                path: '/user/user_item_two',
                name: 'userItemTwo',
                meta: { title: '二级菜单2', isKeepAlive: true },
                component: () => import('@/views/user/userItemTwo.vue')
            },
        ]
    },
    {
        path: '/apply',
        name: 'apply',
        meta: { title: '应用列表', icon: 'service', isKeepAlive: true, },
        children: [
            {
                path: '/apply/apply_item_one',
                name: 'applyItemOne',
                meta: {
                    title: '应用菜单1', isKeepAlive: true, hideMenu: true, // 隐藏子级菜单,不在菜单栏显示
                },
                component: () => import('@/views/apply/applyItemOne.vue'),
                children: [
                    {
                        path: '/apply/apply_item_one/child_one',
                        name: 'applyItemOneChildOne',
                        meta: { title: '应用1-1', isHidden: true, parentName: 'applyItemOne' },
                        component: () => import('@/views/apply/itemOneChild/childOne.vue')
                    },
                    {
                        path: '/apply/apply_item_one/child_two',
                        name: 'applyItemOneChildTwo',
                        meta: { title: '应用1-2', isHidden: true, parentName: 'applyItemOne' },
                        component: () => import('@/views/apply/itemOneChild/childTwo.vue')
                    },
                    {
                        path: '/apply/apply_item_one/child_three',
                        name: 'applyItemOneChildThree',
                        meta: { title: '应用1-3', isHidden: true, parentName: 'applyItemOne' },
                        component: () => import('@/views/apply/itemOneChild/childThree.vue')
                    },
                ]
            },
            {
                path: '/apply/apply_item_two',
                name: 'applyItemTwo',
                meta: { title: '应用菜单2', isKeepAlive: true },
                component: () => import('@/views/apply/applyItemTwo.vue')
            }
        ]
    },
];
export const rootRouter = {
    path: '/',
    component: BasicLayout
};
export default {
    constantRoutes,
    notFount,
    asyncRouters,
    rootRouter
};
